<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:af="http://myfaces.apache.org/trinidad"
	xmlns:afh="http://myfaces.apache.org/trinidad/html">

	<af:tree id="worklistTree" var="node" value="#{portalHeader.worklistModel}"
		disclosedRowKeys="#{portalHeader.disclosedRowKeys}" 
		rowDisclosureListener="#{portalHeader.rowDisclosureListener}"
		styleClass="worklistTree"
        rendered="#{processPortalSettings.hideWorklistIfActivityIsVisible ? not portalHeader.processPortalSession.activityPanelVisible : true}"
        partialTriggers=":bpmEvents:worklistSelectionEvent :bpmEvents:refreshEvent:worklistOutline :bpmEvents:refreshEvent:full">
		<f:facet name="nodeStamp">
			<af:panelBorderLayout styleClass="worklistTreeRow">
				<f:facet name="left">
                    <af:panelGroupLayout>
    					<af:icon name="#{node.iconName}"
    						rendered="#{node.showingIcon}" />
                        <af:spacer height="16px" rendered="#{not node.showingIcon}" />
                    </af:panelGroupLayout>
				</f:facet>

				<af:switcher facetName="#{node.kind}" defaultFacet="folder">
					<f:facet name="folder">
						<af:commandLink id="folderItem" text="#{node.folderLabel}"
                            styleClass="worklistTreeRootFolder"
                            disabled="#{!node.active || portalHeader.processPortalSession.activityPanelVisible}"
                            action="#{node.performAction}"
                            shortDesc="#{node.folderLabel}"
                            partialSubmit="true" />
					</f:facet>

					<f:facet name="startableProcess">
						<af:commandLink text="#{node.folderLabel}"
                            styleClass="worklistTreeItem"
						    disabled="#{!node.active || portalHeader.processPortalSession.activityPanelVisible}"
							action="#{node.performAction}"
                            shortDesc="#{node.folderLabel}"
                            partialSubmit="true" />
					</f:facet>
					
					<f:facet name="workitemFolder">
						<af:commandNavigationItem text="#{node.folderLabel}"
                            styleClass="worklistTreeItem"
						    disabled="#{!node.active || portalHeader.processPortalSession.activityPanelVisible}"
							action="#{node.performAction}"
                            shortDesc="#{node.folderLabel}"
                            partialSubmit="true">
							<af:setActionListener from="#{node.workerObject}"
								to="#{portalHeader.currentWorklistModel}" />
						</af:commandNavigationItem>
					</f:facet>

					<f:facet name="filledWorkitemFolder">
						<af:commandNavigationItem text="#{node.folderLabel}"
                            styleClass="filledWorklistTreeItem"
						    disabled="#{!node.active || portalHeader.processPortalSession.activityPanelVisible}"
							action="#{node.performAction}"
                            shortDesc="#{node.folderLabel}"
                            partialSubmit="true">
							<af:setActionListener from="#{node.workerObject}"
								to="#{portalHeader.currentWorklistModel}" />
						</af:commandNavigationItem>
					</f:facet>
				</af:switcher>

			</af:panelBorderLayout>

		</f:facet>
	</af:tree>
</ui:composition>
